/*
 * 斗公牛协议
 */
let proto = module.exports;

proto.GAME_STATUS_PUSH   = 401;
proto.CHOOSE_BANK_PUSH   = 402;
proto.CHOOSE_BANK_NOTIFY = 302;
proto.BANKER_PUSH        = 403;
proto.CARDS_PUSH         = 404;
proto.POUR_SCORE_NOTIFY  = 305;
proto.POUR_SCORE_PUSH    = 405;
proto.SHOW_CARDS_NOTIFY  = 306;
proto.SHOW_CARDS_PUSH    = 406;
proto.GAME_RESULT_PUSH   = 407;
proto.GAME_END_PUSH      = 408;
proto.GAME_BUREAU_PUSH   = 409; /* 局数推送 */
proto.GAME_CHAT_NOTIFY   = 310; /* 游戏聊天 */
proto.GAME_CHAT_PUSH     = 410;
proto.GAME_TRUST_NOTIFY  = 311; /* 托管 */
proto.GAME_TRUST_PUSH    = 411; /* 托管 */
proto.CLEAR_POOL_PUSH    = 412; /* 清空金币池 */ 
proto.GAME_REVIEW_NOTIFY = 313; /* 牌面回顾 */ 
proto.GAME_REVIEW_PUSH   = 413;

proto.gameStatus = {
	NONE: 0,
	PREPARE: 1,
	CHOOSE_BANK: 2,
	SEND_CARDS: 3,
	POUR_SCORE: 4,
	SHOW_CARDS: 5,
	RESULT: 6,
};

proto.gameStatusTm = {
	NONE:        0,
	CHOOSE_BANK: 5,
	SEND_CARDS:  2,
	POUR_SCORE:  5,
	SHOW_CARDS:  5,
	RESULT:      5,
};

proto.payType = { /* 支付方式 */ 
	AAZHIFU: 1,
	YINGJIAZHIFU: 2,
	WOZHIFU: 3,
};

proto.cardsType = {
	MEINIU:      1,  /* 没牛 */
	YOUNIU:      2,  /* 有牛 */
	NIUNIU:      3,  /* 牛牛 */
	SHUNZINIU:   4,  /* 顺子牛 */
	YINNIU:      5,  /* 银牛 */
	TONGHUANIU:  6,  /* 同花牛 */
	WUHUANIU:    7,  /* 五花牛 */
	HULUNIU:     8,  /* 葫芦牛 */
	WUXIAONIU:   9,  /* 五小牛 */
	ZHADANNIU:   10, /* 炸弹牛 */
	YITIAOLONG:  11, /* 一条龙 */
	TONGHUASHUN: 12, /* 同花顺 */
};

proto.scaleType = { /* 翻倍规则 */ 
	BIG:    1, /* 牛牛(x4)牛九(x3)牛八(x2)牛七(x2) */ 
	LITTLE: 2, /* 牛牛(x3)牛九(x2)牛八(x2) */ 
	DIANZI: 3, /* 点子牛 */
};

proto.lianzhuangType = {
		SHENGZHUANG: 1,
		LUNZHUANG: 2,
	
};

proto.gameStatusPush = function (gameStatus, tick) {
	return {
		type: this.GAME_STATUS_PUSH,
		data: {
			gameStatus: gameStatus,
			tick: tick,
		}
	};
};

proto.chooseBankNotify = function (beBanker) {
	return {
		type: this.CHOOSE_BANK_NOTIFY,
		data: {
			beBanker: beBanker,
		}
	};
};

proto.chooseBankPush = function (chairID) {
	return {
		type: this.CHOOSE_BANK_PUSH,
		data: {
			chairID: chairID,
		}
	};
};

proto.bankerPush = function (bankerChairID, poolScore, bankerTurn, bankerPourTurn) {
	return {
		type: this.BANKER_PUSH,
		data: {
			bankerChairID: bankerChairID, 
			poolScore: poolScore,
			bankerTurn: bankerTurn,
			bankerPourTurn: bankerPourTurn,
		}
	};
};

proto.cardsPush = function (handCards) {
	return {
		type: this.CARDS_PUSH,
		data: {
			handCards: handCards,
		}
	};
};

proto.pourScoreNotify = function (score, shemen) {
	return {
		type: this.POUR_SCORE_NOTIFY,
		data: {
			score: score,
			shemen: shemen,
		}
	};
};

proto.pourScorePush = function (chairID, score, shemen) {
	return {
		type: this.POUR_SCORE_PUSH,
		data: {
			chairID: chairID,
			score: score,
			shemen: shemen,
		}
	};
};

proto.showCardsNotify = function () {
	return {
		type: this.SHOW_CARDS_NOTIFY,
		data: {
		}
	};
};

proto.showCardsPush = function (chairID, cardArray) {
	return {
		type: this.SHOW_CARDS_PUSH,
		data: {
			chairID: chairID,
			cardArray: cardArray,
		}
	};
};

proto.gameResultPush = function (result) {
	return {
		type: this.GAME_RESULT_PUSH,
		data: {
			result: result,
		},
	};
};

proto.gameEndPush = function (result, winMost, loseMost, creater, hongBaoList) {
	return {
		type: this.GAME_END_PUSH,
		data: {
			result: result,
			winMost: winMost,
			loseMost: loseMost,
			creater: creater,
			hongBaoList: hongBaoList,
		},
	};
};

proto.gameBureauPush = function (curBureau, turn, bankerTurn, bankerPourTurn) {
	return {
		type: this.GAME_BUREAU_PUSH,
		data: {
			curBureau: curBureau, /* 局数 */ 
			turn: turn, /* 小局 */ 
			bankerTurn: bankerTurn, /* 当前庄轮数 */ 
			bankerPourTurn: bankerPourTurn, /* 当前玩家下注次数 */ 
		},
	};
};

proto.gameChatNotify = function (type, msg, recipientID) {
	return {
		type: this.GAME_CHAT_NOTIFY,
		data: {
			type: type,
			msg: msg,
			recipientID: recipientID,
		},
	};
};

proto.gameChatPush = function (chairID, type, msg, recipientID) {
	return {
		type: this.GAME_CHAT_PUSH,
		data: {
			chairID: chairID,
			type: type,
			msg: msg,
			recipientID: recipientID,
		},
	};
};
proto.gameTrushNotify = function (trust) {
	return {
		type: this.GAME_TRUST_NOTIFY,
		data: {
			trust: trust,
		},
	};
};
proto.gameTrushPush = function (chairID, trust) {
	return {
		type: this.GAME_TRUST_PUSH,
		data: {
			chairID: chairID,
			trust: trust,
		},
	};
};
proto.clearPoolPush = function (bankerChairID) {
	return {
		type: this.CLEAR_POOL_PUSH,
		data: {
			bankerChairID: bankerChairID,
		}
	};
};
proto.gameReviewNotify = function () {
	return {
		type: this.GAME_REVIEW_NOTIFY,
		data: {
		},
	};
};

proto.gameReviewPush = function (list) {
	return {
		type: this.GAME_REVIEW_PUSH,
		data: {
			list: list,
		},
	};
};

